<?php

/**
 * University form base class.
 *
 * @method University getObject() Returns the current form's model object
 *
 * @package    Amman to London
 * @subpackage form
 * @author     Adel Abu-Saif <adeljas@msn.com>
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseUniversityForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'name_en'       => new sfWidgetFormInputText(),
      'address_en'    => new sfWidgetFormTextarea(),
      'name_ar'       => new sfWidgetFormInputText(),
      'address_ar'    => new sfWidgetFormTextarea(),
      'telephone'     => new sfWidgetFormInputText(),
      'acronym'       => new sfWidgetFormInputText(),
      'business_type' => new sfWidgetFormChoice(array('choices' => array('by_course' => 'by_course', 'by_semester' => 'by_semester'))),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'name_en'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'address_en'    => new sfValidatorString(array('required' => false)),
      'name_ar'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'address_ar'    => new sfValidatorString(array('required' => false)),
      'telephone'     => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'acronym'       => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'business_type' => new sfValidatorChoice(array('choices' => array(0 => 'by_course', 1 => 'by_semester'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('university[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'University';
  }

}
